﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.IO;

namespace Matthew
{
    public partial class FrmInvoice2 : Form
    {
        public Order order;
        public string invoiceID;

        public FrmInvoice2()
        {
            InitializeComponent();
        }

        public void Initialize()
        {
            this.Text = "Order Details for Order " + order.OrderID;
            lblOrderID.Text = "Order ID: " + order.OrderID;
            dgvOrderDetails.DataSource = DBManager.GetProductDetails(order.OrderID);
            txtInvoiceID.Text = invoiceID;
        }

        private void btnBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            AllFormClass.FormInvoice.Show();
        }

        private void btnIssueInvoice_Click(object sender, EventArgs e)
        {
            if (AllFormClass.FormInvoice.issueInvoice(order, txtInvoiceID.Text))
            {
                this.Hide();
                AllFormClass.FormInvoice.Show();
            }
        }
    }
}
